home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 March
/
PCWorld_2008-03_cd.bin
/
v cisle
/
pcwmultilink
/
pcwMultilink.V2.exe
/
pcwMultilink.V2.VBS
Wrap
Text File
|
2008-01-22
|
7KB
|
180 lines
' pcwMultilink.V2 slou₧φ k pohodlnΘmu vytvß°enφ multifunkΦnφch ikon na pracovnφ plochu.
' Do automaticky otev°enΘ slo₧ky Links.TMP umφstφte vÜechny zßstupce program∙, slo₧ek Φi soubor∙,
' kterΘ se majφ v multifunkΦnφ ikon∞ objevit.
' Na zßklad∞ t∞chto polo₧ek vytvo°φ skript ikonku, kterß bude v kontextovΘm menu obsahovat
' vÜechny vßmi po₧adovanΘ odkazy.
' Zßstupci ve slo₧ce Links.TMP a slo₧ka samotnß se po ukonΦenφ skriptu automaticky odstranφ.
'
' Skript se nijak neinstaluje, lze jej umφstit do livbovolnΘ slo₧ky a libovoln∞ p°esouvat Φi p°ejmenovat.
' Skript spustφte poklepßnφm-
' MultifunkΦnφ ikonu odstranφte tak, ₧e ji upustφte na ikonu souboru skriptu.
dim menuname(50)
dim programm(50)
dim ziel(50)
dim Parameter(50)
dim myDesktop
Set myfiles = CreateObject("Scripting.FileSystemObject")
Set myshell = CreateObject("Wscript.Shell")
Set myEnv = myShell.Environment("PROCESS")
set myArgs=wscript.arguments
mydesktop=myShell.SpecialFolders("Desktop")
tempfolder=myEnv("TEMP") & "\Links.TMP"
'Drag & Drop (Odstranit multifunkΦnφ ikonu) ?
if myArgs.Count > 0 then
DeleteLink myArgs(0)
wscript.quit
end if
on error resume next
MyFiles.CreateFolder(tempfolder)
myShell.run "explorer.exe /n," & tempfolder,1,true
wscript.sleep 1000
msgbox "Umφst∞te, prosφm, po₧adovanΘ zßstupce do otev°enΘ slo₧ky 'Links.tmp'." _
& chr(13) & chr(13) & "P°φpadn∞ opravte nßzvy zßstupc∙." _
& chr(13) & chr(13) & "P°φpony u soubor∙ jako nap°φklad '.EXE' se odeberou automaticky." _
& chr(13) & "╪et∞zec 'Zßstupce -' ('Shortcut to') se rovn∞₧ odstranφ." _
& chr(13) & "Ostatnφ znaky v nßzvu (malß/velkß pφsmena atd.) se objevφ v kontextovΘm menu" _
& chr(13) & " multifunkΦnφ ikony p°esn∞ tak, jako by se jednalo o nßzev obyΦejnΘho zßstupce." _
& chr(13) & chr(13) & "Nakonec, po vytvo°enφ vÜech polo₧ek kontextovΘho menu, pokraΦujte stiskem 'OK' ..." _
& chr(13) & chr(13) & "(Zßstupci doΦasn∞ vytvo°enφ ve slo₧ce 'Links.tmp' se odstranφ automaticky.)",," Vytvo°it novou multifunkΦnφ ikonu"
set lnkfolder=MyFiles.Getfolder(tempfolder)
set linkfiles=lnkfolder.Files
for each link in linkfiles
check=ucase(right(link.name,4))
if check=".LNK" Or check=".PIF" then
clink=clink+1
menuname(clink)=link.name
i=instr(menuname(clink),".")
menuname(clink)=left(menuname(clink),i-1)
menuname(clink)=replace(menuname(clink),"Zßstupce -","")
menuname(clink)=replace(menuname(clink),"Shortcut to ","")
set multilink=MyShell.CreateShortcut(link.path)
Ziel(clink)=multilink.Targetpath
Ziel(clink)=replace(Ziel(clink),chr(34),"")
Parameter(clink)=multilink.Arguments
if myFiles.FolderExists(Ziel(clink)) then
ziel(clink)="explorer.exe /n," & chr(34) & ziel(clink) & chr(34)
Programm(clink)="explorer.exe"
else
temp=lcase(right(ziel(clink),4))
if temp=".exe" or temp=".com" or temp=".bat" then
Programm(clink)=Ziel(clink)
Ziel(clink)=chr(34) & Ziel(clink) & chr(34) & " " & parameter(clink)
else
ftype=myShell.regread("HKCR\" & temp & "\")
programm(clink)=myShell.regread("HKCR\" & ftype & "\shell\open\command\")
programm(clink)=replace(programm(clink),chr(34),"")
i=instr(lcase(programm(clink)),".exe")
if i=0 then i=instr(lcase(programm(clink)),".com")
if i=0 then i=instr(lcase(programm(clink)),".bat")
programm(clink)=left(programm(clink),i+3)
ziel(clink)=chr(34) & programm(clink) & chr(34) & " " & chr(34) & ziel(clink) & chr(34)
end if
ziel(clink)=replace(ziel(clink),"%SystemRoot%",myEnv("SYSTEMROOT"))
ziel(clink)=replace(ziel(clink),"%ProgramFiles%",myEnv("PROGRAMFILES"))
programm(clink)=replace(programm(clink),"%SystemRoot%",myEnv("SYSTEMROOT"))
programm(clink)=replace(programm(clink),"%ProgramFiles%",myEnv("PROGRAMFILES"))
end if
Ziel(clink)=inputbox("Zkontrolujte prosφm, zßstupce..."," Vytvo°it multifunkΦnφ ikonu",Ziel(clink))
end if
next
if clink=0 then
msgbox "Ve slo₧ce " & tempfolder & " nebyly nalezeni ₧ßdnφ zßstupci.",," Multilink"
myFiles.DeleteFolder tempfolder,True
wscript.quit
end if
for temp=1 to clink
allmenus=allmenus & "(" & temp & ") " & menuname(temp) & chr(13)
next
mainjob=inputbox(clink & " Byly nalezeni zßstupci. Vyberte hlavnφho zßstupce:" & chr(13) & chr(13) & allmenus," Vytvo°it multifunkΦnφ ikonu")
for temp=1 to clink
if mainjob = cstr(temp) then mainok=1
next
if mainok=0 then
msgbox "Nevybrali jste ₧ßdnΘho hlavnφho zßstupce.",,"P°eruÜit"
myFiles.DeleteFolder tempfolder,True
wscript.quit
end if
if Parameter(mainjob)="" then
MainCommand=ziel(mainjob) & " %*"
else
MainCommand=ziel(mainjob) & " " & Parameter(mainjob) & " %*"
end if
do
count=count + 1
regkey="HKCR\.089" & count & "\"
err.clear
tmp=myshell.regRead(regkey)
loop while err.number=0
Dateityp=".089" & count
datei=mydesktop & "\" & menuname(mainjob) & Dateityp
if programm(mainjob)="explorer.exe" then
symbol="Shell32.dll,3"
else
msgbox programm(mainjob)
if ucase(right(programm(mainjob),4))=".EXE" then
symbol=programm(mainjob) & ",0"
else
symbol="pifmgr.dll," & count
end if
end if
myshell.regwrite("HKCR\" & Dateityp & "\"),""
myshell.regwrite("HKCR\" & Dateityp & "\NeverShowExt"),""
myshell.regwrite("HKCR\" & Dateityp & "\DefaultIcon\"),symbol
myshell.regwrite("HKCR\" & Dateityp & "\ScriptEngine\"),"VBScript"
myshell.regwrite("HKCR\" & Dateityp & "\Shell\"),""
myshell.regwrite("HKCR\" & Dateityp & "\Shell\Open\"),menuname(mainjob)
myshell.regwrite("HKCR\" & Dateityp & "\Shell\Open\Command\"),maincommand
myshell.regwrite("HKCR\" & Dateityp & "\ShellEx\"),""
myshell.regwrite("HKCR\" & Dateityp & "\ShellEx\DropHandler\"),"{60254CA5-953B-11CF-8C96-00AA00B8708C}"
myshell.regwrite("HKCR\" & Dateityp & "\Shell\{Poznßmky}\"),""
myshell.regwrite("HKCR\" & Dateityp & "\Shell\{Poznßmky}\Command\"),"notepad.exe " & datei
for temp=1 to clink
if cstr(temp) <> cstr(mainjob) then
myshell.regwrite("HKCR\" & Dateityp & "\Shell\" & menuname(temp) & "\"),""
myshell.regwrite("HKCR\" & Dateityp & "\Shell\" & menuname(temp) & "\Command\"),ziel(temp) & " " & parameter(temp)
end if
next
set multilink=myFiles.CreateTextFile(datei)
multilink.writeline ".LOG --- POZN┴MKY --- POZN┴MKY --- POZN┴MKY ---"
multilink.close
myFiles.DeleteFolder tempfolder,True
'------------------------------------------------------------------------------
Sub DeleteLink (ByVal Datei)
Erweiterung=myFiles.GetExtensionName(datei)
if left(erweiterung,3)<>"089" then
msgbox "UpuÜt∞n² objekt nenφ multifunkΦnφ ikona...",," Odstranit multifunkΦnφ ikonu"
wscript.quit
end if
tmp=msgbox("Chcete odstranit soubor " & (datei & chr(13) & "a z registru zßznam o typu souboru " & Erweiterung _
& " ?"),4," Odstranit multifunkΦnφ ikonu")
if tmp=7 then wscript.quit
tmp=myFiles.DeleteFile(datei,TRUE)
Import=myDesktop & "\pcwtemp.reg"
set myImport=myFiles.CreateTextFile(Import)
myImport.writeline "REGEDIT4"
myImport.writeline ""
myImport.writeline "[-HKEY_CLASSES_ROOT\." & erweiterung & "]"
myImport.close
wscript.sleep 500
myShell.run "regedit.exe /s " & chr(34) & Import & chr(34),,TRUE
wscript.sleep 500
tmp=myFiles.DeleteFile(import,TRUE)
end sub